Arduino real time clock with DS1307 您所在的位置:网站首页 DS1307 Interface with PIC16F887 Arduino real time clock with DS1307

Arduino real time clock with DS1307

2024-07-16 22:26| 来源: 网络整理| 查看: 265

Arduino real time clock with DS1307, LCD and set buttons

This post shows a simple real time clock and calendar example using an Arduino UNO board and DS1307 RTC chip where time and calendar are displayed on 1602 LCD screen and it can be set with two push buttons.

The DS1307 is an IC (integrated circuit) which has only 8 pins, it’s low cost, easy to use and it has the ability to count time and date in real time (more details are in the datasheet).

DS1307 RTC pin configuration

Hardware Required:

Arduino boardDS1307 RTC16×2 LCD screen32.768KHz crystal oscillator2 x push button2 x 10K ohm resistor10K ohm variable resistor (or potentiometer)330 ohm resistor3V coin cell batteryBreadboardJumper wires

Arduino real time clock with DS1307 circuit:

Arduino DS1307 LCD and set buttons circuit

In the circuit there are 2 push buttons (B1 & B2) connected to pins 8 and 9 respectively, the two push buttons are used to set time date parameters (minutes, hours, date, month and year). Button B1 selects the parameter and B2 increments the selected parameter.

Arduino real time clock with DS1307 code: The Arduino code below doesn’t use any library for the DS1307 RTC, the Wire library is for the communication between the Arduino and the DS1307 using I2C protocol.

The DS1307 works with BCD format only and to convert the BCD to decimal and vise versa I used the 2 lines below (example for minute): // Convert BCD to decimal minute = (minute >> 4) * 10 + (minute & 0x0F);

// Convert decimal to BCD minute = ((minute / 10)



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有